import { request } from '@/utils/request';
import { RequestEnum } from '@/enums/httpEnum';

export const customerServiceApi = {
  customerServiceList: '/customerService/list',
  customErrorServiceListJson: '/customerService/listJson',
  customerServiceDetail: '/customerService/detail',
  customerServiceAdd: '/customerService/add',
  customerServiceUpdate: '/customerService/update',
  customerServiceDelete: '/customerService/delete',
} as const;

export const getCustomerServiceList = () => {
  return request({
    url: customerServiceApi.customErrorServiceListJson,
    method: RequestEnum.GET,
  });
};

export const createCustomerService = (data: API.CreateCustomerServiceParams) => {
  return request({
    url: customerServiceApi.customerServiceAdd,
    method: RequestEnum.POST,
    data,
  });
};

export const updateCustomerService = (data: API.UpdateCustomerServiceParams) => {
  return request({
    url: customerServiceApi.customerServiceUpdate,
    method: RequestEnum.PUT,
    data,
  });
};

export const deleteCustomerService = (params: { id: number }) => {
  return request({
    url: customerServiceApi.customerServiceDelete,
    method: RequestEnum.DELETE,
    params,
  });
};
